#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

off_t flen(char *path){
	struct stat fstat;
	if (stat(path, &fstat) < 0) {
		perror("stat()");
		exit(1);
	}
	return fstat.st_size;
}


int main(int argc, char * argv[])
{
	if (argc < 2) {
		perror("flen <filepath>");
		exit(1);
	}
	
	off_t fsize = flen(argv[1]);
	printf("file size: %lld\n", (long long)fsize);
	exit(0);
}
